package com.sand.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class OperationAspect {


    /**
     *
     */
    @Pointcut("@annotation(operation)")
    public void po(){}


    /**
     * 异常后执行
     * @param e
     */
    @AfterThrowing(value = "po()" , throwing = "e")
    public void Exception(Exception e){
        log.info("异常出现");
        System.out.println(e.getMessage());
    }

}
